const { DataTypes } = require("sequelize");

const seq = require("../db/seq");

const User = seq.define("zd_user", {
  user_name: {
    type: DataTypes.STRING(100),
    allowNull: false,
    unique: true,
    comment: "用户名，唯一",
  },
  password: {
    type: DataTypes.CHAR(64),
    allowNull: false,
    comment: "密码",
  },
  is_admin: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: 0,
    comment: "0 不是管理员 1 管理员",
  },
});

// User.sync({ force: true })
//   .then((res) => {
//     console.log(res);
//   })
//   .catch((error) => {
//     console.log(error);
//   });

module.exports = User;
